home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Pane2 / c / PaneOpenH < prev    next >
Text File  |  1995-08-23  |  2KB  |  70 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Pane2.PaneOpenH.c
  12.     Author:  Copyright © 1995 Andrew Sellors.
  13.     Version: 1.04 (4th August 1995)
  14.     Purpose: Handles windows with panes.
  15. */
  16.  
  17. #include "DeskLib:Pane2.h"
  18. #include "Pane2Defs.h"
  19. #include "Desklib:Event.h"
  20. #include "DeskLib:Template.h"
  21. #include "Desklib:EventMsg.h"
  22. #include "Desklib:Error.h"
  23.  
  24. /******************************************************************************/
  25.  
  26. extern BOOL PaneOpenEventHandler(event_pollblock *event, void *reference)
  27. {
  28.  /*
  29.   * event handler for panes that can be moved (!ArtWorks style)
  30.   * records movement and updates paneoffset
  31.   */
  32.   window_state panestate;
  33.   window_state mainstate;
  34.   pane_listelement *paneelement = reference;
  35.  
  36.   Wimp_OpenWindow(&(event->data.openblock));
  37.  
  38.  /*
  39.   * get positions of main and pane windows
  40.   */
  41.   Wimp_GetWindowState(paneelement->panewindow, &panestate);
  42.   Wimp_GetWindowState(paneelement->mainwindow, &mainstate);
  43.  
  44.  /*
  45.   * update pane offset
  46.   */
  47.   if(paneelement->paneflags.data.mainright)
  48.      paneelement->paneoffset.x = panestate.openblock.screenrect.min.x -
  49.                                  mainstate.openblock.screenrect.max.x;
  50.   else
  51.      paneelement->paneoffset.x = panestate.openblock.screenrect.min.x -
  52.                                  mainstate.openblock.screenrect.min.x;
  53.  
  54.  
  55.   if(paneelement->paneflags.data.maintop) /* pane fixed to top of window */
  56.      paneelement->paneoffset.y = mainstate.openblock.screenrect.max.y;
  57.  
  58.   else /* pane fixed to bottom of window */
  59.      paneelement->paneoffset.y = mainstate.openblock.screenrect.min.y;
  60.  
  61.   if(paneelement->paneflags.data.panetop) /* pane fixed using top of pane */
  62.      paneelement->paneoffset.y -= panestate.openblock.screenrect.max.y;
  63.  
  64.   else /* pane fixed using bottom of pane */
  65.      paneelement->paneoffset.y -= panestate.openblock.screenrect.min.y;
  66.  
  67.  
  68.   return(TRUE);
  69. }
  70.